<?php

namespace App\Controller\User\Sign;

use App\Constants\SignTask;
use App\Controller\User\BaseController;
use App\Dao\Sign\SignTaskLogDao;
use App\Middleware\AuthTokenMiddleware;
use App\Middleware\CheckLoginMiddleware;
use App\Model\Sign\SignTaskLog;
use App\Service\Sign\SignTaskService;
use Hyperf\Di\Annotation\Inject;
use Hyperf\HttpServer\Annotation\Middleware;
use phpDocumentor\Reflection\Types\Collection;
use Yj\Apidog\Annotation\ApiController;
use Yj\Apidog\Annotation\FormData;
use Yj\Apidog\Annotation\PostApi;


/**
 * @Middleware(AuthTokenMiddleware::class)
 * @ApiController(prefix="user/sign/task")
 */
class SignTaskController extends BaseController
{

    /**
     * @Inject()
     * @var SignTaskService
     */
    protected $signTaskService;


    /**
     * @PostApi(path="do")
     * @FormData(key="code")
     * @return void
     */
    public function do(){
        $code = $this->getParams()->get('code');
        $user_id = $this->getUid();
        $this->signTaskService->do($user_id,$code);
        _SUCCESS();
    }

    /**
     * @PostApi(path="receive")
     * @FormData(key="code")
     * @return void
     */
    public function receive(){
        $code = $this->getParams()->get('code');
        $user_id = $this->getUid();
        $this->signTaskService->receive($user_id,$code);
        _SUCCESS();
    }
}